import React, {Component} from 'react';
import TabBar from '../../components/TabBar';

import {Link} from "react-router-dom";

import {connect} from 'react-redux';
import {setUser} from '../../redux/actions/user';

class My extends Component {

	componentWillMount() {

	}

	componentDidMount() {

	}

	componentWillUnmount() {

	}

	loginOut = () => {
		sessionStorage.removeItem('user');
		this.props.setUser({});
		this.props.history.push('/login');
	}

	render() {
		return (
			<>
				<h1>首页</h1>
				<Link to="/addressList">地址管理</Link>
				<button onClick={this.loginOut}>退出登录</button>
				{/*<TabBar/>*/}
			</>
		);
	}
}


export default connect(
	state => ({
		user: state.user
	}),
	{setUser}
)(My);